import instance from '../http/Myaxios'
// 管理员登录
export const loginAPI = ({username, password}) => {
    return instance({
        url: '/admin/login',
        method: 'POST',
        data: {
            username,
            password
        }
    })
}

// 首页 indexView

/**
 * 获取用户列表
 */
export const getUserListAPI = ({ page, pagesize }) => {
    return instance({
        url: '/userlist',
        method: 'GET',
        params: {
            page,
            pagesize
        }
    })
} 
// 根据ID删除用户
export const delUserAPI = ({id}) => {
    return instance({
        url: '/user-del',
        method: 'POST',
        data: {
            id
        }
    })
}
// 用户名模糊查询
export const selectUserAPI = ({uname}) => {
    return instance({
        url: '/user-name',
        method: 'POST',
        data: {
            uname
        }
    })
}
// 获取订单列表
export const getOrderListAPI = ({ page, pagesize }) => {
    return instance({
        url: '/order-list',
        method: 'GET',
        params: {
            page,
            pagesize
        }
    })
}
// 删除订单
export const delOrderAPI = ( { id }) => {
    return instance({
        url: '/order-del',
        method: 'POST',
        data: {
           id
        }
    })
}
// 获取评论列表
export const disListAPI = ({ page, pagesize }) => {
    return instance({
        url: '/discusslist',
        method: 'GET',
        params: {
            page,
            pagesize
        }
    })
}
// 根据ID删除评论
export const deleDisAPI = ({id}) => {
    return instance({
        url: '/discuss-del',
        method: 'POST',
        data: { id }
    })
}
/**
 * 景点管理API
 * @param {*} param0 
 * @returns 
 */
// 获取景点列表
export const getScenicListAPI = ({ page,pagesize }) => {
    return instance({
        url: '/scenic-list',
        method: 'GET',
        params: {
            page,
            pagesize
        }
    })
}
// 删除景点
export const delScenicAPI = ({ scenicId }) => {
    return instance({
        url: '/scenic-del',
        method: 'POST',
        data: {
            scenicId
        }
    })
}
// 修改景点
export const editScenicAPI = (data) => {
    return instance({
        url: '/scenic-edit',
        method: 'POST',
        data
    })
}
// 根据景点ID查询景点--铺设景点修改页面
export const getSceincById = ({scenicId}) => {
    return instance({
        url: '/scenic/id',
        method: 'POST',
        data: {
            scenicId
        }
    })
}
// 景点名称模糊搜索
export const selectScenicByName = ({name}) => {
    return instance({
        url: '/scenic-name',
        method: 'POST',
        data: {
            name
        }
    })
}
// 增加景点
export const addScenicAPI = (data) => {
    return instance({
        url: '/scenic-add',
        method: 'POST',
        data
    })
}